<template>
    <div class="el-notfound">
        <h2>页面未找到,<span>{{times}}</span>后返回<span @click="backIndex">首页</span></h2>
    </div>
</template>
<script>
export default {
    name:"NotFound",
    data(){
        return {
            times:5,
        }
    },
    methods:{
        backIndex(){
            this.$router.push('/menu')
            clearInterval(this.time)
        }
    },
    created(){
        this.time = setInterval(()=>{
            this.times>0?this.times--:this.$router.push('/menu')
        },1000)
    },
    beforeDestroy(){
        clearInterval(this.time)
    }
}
</script>
<style scoped>
</style>